from gui import gui
from gui . tests . create_widget_test_assistant import gui_create_widget_test_assistant

class application_window_fake :
    pass

class frame_fake :
    def __init__ ( self ) :
        self . _destroyed = None
    def destroy ( self ) :
        self . _destroyed = True

class tkinter_fake :
    def __init__ ( self ) :
        self . _frame_collection = [ ]
    def Tk ( self ) :
        return application_window_fake ( )
    def Frame ( self , master ) :
        frame = frame_fake ( )
        self . _frame_collection += [ frame ]
        return frame

class mediator_fake :
    def __init__ ( self ) :
        self . _gui_create_application_window_reply = None
        self . _gui_create_frame_reply = None
    def gui_create_application_window_reply ( self , window ) :
        self . _gui_create_application_window_reply = window
    def gui_create_frame_reply ( self , frame ) :
        self . _gui_create_frame_reply = frame 

class gui_frame_tests :
    'gui_frame'
    def __init__ ( self , test ) :
        self . _assistant = gui_create_widget_test_assistant ( test )
        self . _test = test
        self . _tkinter = tkinter_fake ( )
        self . _mediator = mediator_fake ( )
        self . _gui = gui ( mediator = self . _mediator , tkinter = self . _tkinter , tkfont = None , scheduler = None )
        frame_fake . _deleted_count = 0
    def test_gui_create_frame ( self ) :
        self . _assistant . check_gui_create_arbitrary_element ( 'frame' )
    def test_gui_create_frame_args ( self ) :
        self . _assistant . check_gui_create_arbitrary_element_args ( 'frame' )
    def test_gui_create_frame_persistance ( self ) :
        self . _assistant . check_gui_create_arbitrary_element_persistance ( 'frame' )
    def test_gui_create_frame_destruction ( self ) :
        self . _assistant . check_gui_create_arbitrary_element_destruction ( 'frame' )
    def test_gui_create_frame_encapsulation ( self ) :
        self . _assistant . check_gui_create_arbitrary_element_encapsulation ( 'frame' )
    def test_gui_create_frame_child ( self ) :
        self . _assistant . check_gui_create_arbitrary_element_child ( 'frame' )
    def test_gui_destroy_frame ( self ) :
        self . _gui . gui_create_application_window_request ( )
        window = self . _mediator . _gui_create_application_window_reply
        self . _gui . gui_create_frame_request ( window )
        frame = self . _mediator . _gui_create_frame_reply
        self . _gui . gui_destroy_frame ( frame )
        self . _test . assume_true ( self . _tkinter . _frame_collection [ 0 ] . _destroyed )
